package com.service.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.service.dao.model.MemberMiningOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface MemberMiningOrderMapper extends BaseMapper<MemberMiningOrder> {

	@Select("select * from hm_member_mining_order where is_finish = 0 and start_time <= NOW() and release_day < 180")
	List<MemberMiningOrder> listUnFinishedOrder();

	/**
	 * 统计用户线性冻结总资产
	 * @param memberId
	 * @param coinsId
	 * @return
	 */
	BigDecimal totalMiningFrostNum(@Param("memberId") Integer memberId, @Param("coinsId")Integer coinsId,@Param("orderId")Integer orderId,@Param("someDay")String someDay);

	/**
	 * 统计用户线性冻结总释放
	 * @param memberId
	 * @param coinsId
	 * @return
	 */
	BigDecimal totalMiningReleaseNum(@Param("memberId") Integer memberId, @Param("coinsId")Integer coinsId,@Param("orderId")Integer orderId, @Param("someDay")String someDay);

	/**
	 * @Description: 统计当前用户还有多少待释放数量
	 * @Author: ty
	 * @Date: 2021/4/30 13:46
	 * @param: [memberId, coinsId]
	 * @return: java.math.BigDecimal
	 **/
	BigDecimal totalWaitReleaseNum(@Param("memberId")Integer memberId, @Param("coinsId")Integer coinsId);
}
